<template>
    <div id='tem'>
        <div id='mui-content' class="mui-content" style="background-color:#fff">
            <ul class="mui-table-view mui-grid-view">
                <li v-for='item in list' class="mui-table-view-cell mui-media mui-col-xs-6">
                    <router-link v-bind="{to:'/goods/goodsinfo/'+item.id}">
                        <img class="mui-media-object" :src="item.img_url">
                        <div class="mui-media-body">{{item.title}}</div>
                        <div class="desc">
                            <p>
                                <span>￥{{item.sell_price}}</span>
                                <s>￥{{item.market_price}}</s>
                            </p>
                            <p>
                                <h6 class="left">热卖中</h6>
                                <h6 class="right">剩余{{item.stock_quantity}}件</h6>
                            </p>
                        </div>
                    </router-link>
                </li>
                </ul>
            </div>
    </div>

</template>


<script>
    import common from '../../kits/common.js';
    import { Taost } from 'mint-ui'
    export default{
        data(){
            return{
                list:[]
            }
        },
        created(){
            this.getlist();
        },
        methods:{
            getlist(){
                var url=common.apidomain+'/api/getgoods?pageindex=1';
                this.$http.get(url).then(function(res){
                    if(res.body.status!=0){
                        Taost(res.body.message);
                        return;
                    }
                    this.list=res.body.message;
                })
            }
        }
    }
</script>

<style scoped>
    #mui-content li{
        padding-left: 0;
        margin-left: 4px;
        box-shadow: 0 0 4px #ccc;
        border: 1px solid rgba(0,0,0,.4);
    }
    #mui-content .mui-media-body{
        color:#0094ff;
    }
    #mui-content .desc{
        position: relative;
        text-align: left;
        padding: 5px;
        margin-top: 10px;
        height: 60px;
        background-color: rgba(0,0,0,0.1);
    }
    #mui-content .desc span{
        color:#f00;
    }
    #mui-content a{
        padding-left: 0;
        margin-left: 0;
    }
    #mui-content .desc .right {
          position: absolute;
          right: 10px;
          bottom: 0;
      }
    #mui-content .desc .left {
        position: absolute;
        left: 10px;
        bottom: 0;
    }
</style>